<?php
/**
 * Server response with user's roster 
 * 
 * @package stanza.iq.roster
 */
class Zend_Jabber_Stanza_Response_Iq_Roster_Result extends Zend_Jabber_Stanza_Response_Iq_Roster_Abstract {
    /**
     * Roster
     *
     * @var Zend_Jabber_AddressBook
     */
    private $roster;
    
    /**
     * Create a roster response object
     *
     * @param DomDocument $dom Response xml
     * @param integer $id Response id
     */
    public function __construct(DomDocument $dom, $id) {
        parent::__construct($dom, $id);
        
        $you = Zend_Jabber_User::getInstance($this->iqNode->getAttribute('from'));
        $this->addressBook = new Zend_Jabber_AddressBook($you);
        
        $this->createRostersItems($this->addressBook);
    }
    
    /**
     * Get user roster
     * 
     * @return Zend_Jabber_AddressBook
     */
    public function getAddressBook() {
        return $this->addressBook;
    }
}
?>